/**
 * Created by admin on 2017/8/31.
 */
define(['app', 'filters/filters'], function(app) {
    app.register.controller('ablityAssessRecord', function($scope, $Ajax, $state, $sce, $stateParams, $rootScope) {
        var http = app._baseUrl;
        $scope.pagedata={//分页插件请求数据接口
            url:http + "/My/MyAbility/abilityCheckList",
            pageSize:10,
            currentPage:1,
            returnValue:[],
            isShow:false,
            isKong:false,
            loading_show:true,
            cate_ids:'',
            check_levels:'',
            change:{}
        };
        //  -----------------------------------  删除评测记录二次弹窗
        $scope.tipModule = {
            showTip:false,
            isAjax:true,
            id:'',
            show:function(id){
                this.isAjax = true;
                this.showTip = true;
                this.id = id;
            },
            hide:function(){
                this.showTip = false;
            },
            del:function(){
                this.show();
            },
            cancel:function(){
                this.hide();
            },
            confirm:function(){
                if(this.isAjax){
                    this.isAjax = false;
                    var url = http + '/My/MyAbility/abilityDeleteForUser';
                    var data = {
                        ability_check_id:this.id
                    }
                    $Ajax.postData(url,data).then(function(res){
                        if(res.data.success){
                            $scope.pagedata.change(null,1);
                            $scope.tipModule.hide();
                        }
                    })
                }
            }
        };
        $scope.tipModal = {
            isShow: false,
            title: '温馨提示',
            data: {},
            confirm: function() {
                this.hide()
            },
            cancel: function() {
                this.hide()
            },
            hide: function() {
                this.isShow = false;
            },
            show: function() {
                this.isShow = true;
            }
        }
        if($rootScope.num==0){
            $scope.tipModal.show();
            $rootScope.num=1;
        }
    })
})